package com.rxh.mapper.core;

import com.rxh.mapper.base.BaseMapper;
import com.rxh.pojo.base.SearchInfo;
import com.rxh.pojo.core.CoreOrderChange;
import com.rxh.vo.VoAbnormal;
import com.rxh.vo.VoCoreOrderChange;
import com.rxh.vo.VoOrderStatistics;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

public interface CoreOrderChangeMapper extends BaseMapper<CoreOrderChange, Long> {

    /**
     * 获取商户指定异常状态订单总数
     *
     * @param types      异常类型 数组 可含有多种异常状态
     * @param status     银行申请状态 0：未审核，1：成功，2：失败，3：银行处理中
     * @param searchInfo 起始时间/结束时间 若结束时间为空 则查询范围为起始时间至今
     * @return 查询结果
     */
    List<Map<String, Object>> selectCount(@Param("types") Short types[], @Param("status") Short status[], @Param("searchInfo") SearchInfo searchInfo);

    List<CoreOrderChange> selectDetailByOrderId(Long orderId);

    int insertBatch(List<CoreOrderChange> orderChanges);

    CoreOrderChange selectUnaudited(Long orderId);

    List<VoCoreOrderChange> selectMerchantOrderChangeBySearchInfo(SearchInfo searchInfo);

    List<VoCoreOrderChange> selectMerchantOrderChangeForExport(SearchInfo searchInfo);

    List<VoCoreOrderChange> queryOrderChangeList(VoCoreOrderChange orderchange);

    List<VoCoreOrderChange> queryOrderChangeList(Map<String, Object> map);

    List<VoCoreOrderChange> queryOrderChangeByParam(Map<String, Object> map);

    List<Map<String, String>> queryOrderChangeStatistics(Map<String, Object> map);

    int getOrderChangeCountByParam(Map<String, Object> paramMap);

    List<VoAbnormal> getcoreOrderChangeInfo(Map<String, Object> paramMap);

    List<VoAbnormal> getAbnormalCheck(Map<String, Object> paramMap);

    Boolean getAbnormalAudit(Map<String, Object> paramMap);

    int getAbnormalCheckNum();

    CoreOrderChange selectOrderChangeByOrderId(Long orderId);

    VoOrderStatistics selectStatisticsBySearchInfo (SearchInfo searchInfo);

    BigDecimal selectRmbAmountBySearchInfo(SearchInfo searchInfo);

    Integer selectCountBySearchInfo(SearchInfo searchInfo);

    int updateCoreMerchantOrderId(@Param("newId") Long newId,@Param("oldId") Long oldId);
}